<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<div id="jobDetailModal" class="modal fade" tabindex="-1"
	role="dialog" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<form class="form-horizontal" name="jobDetailForm" ng-submit="addJobDetail()">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title">
						<i class="mark"></i> <span>新增子任务</span>
					</h4>
				</div>
				<div class="modal-body">
					<div class="form-group has-feedback" ng-class="{'has-error' : jobDetailForm.name.$invalid && jobDetailForm.name.$dirty, 
							'has-warning': jobDetailForm.name.$invalid && !jobDetailForm.name.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">子任务名称:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" ng-model="jobDetailVO.name" name="name"
								placeholder="格式：JD_应用名_模块名_序号(序号可选)" ng-pattern="/^JD_\w+$/" ng-maxlength="250" ng-required="true" /> 
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true" 
								ng-show="jobDetailForm.name.$invalid && jobDetailForm.name.$dirty"></span>
							<span class="glyphicon glyphicon-warning-sign form-control-feedback" aria-hidden="true"
								ng-show="jobDetailForm.name.$invalid && !jobDetailForm.name.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-class="{'has-error' : jobDetailForm.jobId.$invalid && jobDetailForm.jobId.$dirty, 
								'has-warning': jobDetailForm.jobId.$invalid && !jobDetailForm.jobId.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">任务:</label>
						<div class="col-md-8">
							<input select2 type="text" class="form-control input-sm" name="jobId"
								ng-model="jobDetailVO.jobId" select2-model="jobDetailVO.job" config="jobSelectConfig" ng-required="true" /> 
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
								ng-show="jobDetailForm.jobId.$invalid && jobDetailForm.jobId.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-class="{'has-error' : jobDetailForm.jobDetailAddType.$invalid && jobDetailForm.jobDetailAddType.$dirty, 
								'has-warning': jobDetailForm.jobDetailAddType.$invalid && !jobDetailForm.jobDetailAddType.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">生成方式:</label>
						<div class="col-md-8">
							<input select2 type="text" class="form-control input-sm" name="jobDetailAddType" 
								ng-model="jobDetailVO.jobDetailAddType" config="buildTypeSelectConfig" ng-required="true" /> 
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
								ng-show="jobDetailForm.jobDetailAddType.$invalid && jobDetailForm.jobDetailAddType.$dirty"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label control-label-sm">开始时间:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm date" ng-model="jobDetailVO.startTime" placeholder="默认当前时间"/>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label control-label-sm">结束时间:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm date" ng-model="jobDetailVO.endTime" />
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobDetailVO.jobDetailAddType == 'alone'"
						ng-class="{'has-error' : jobDetailForm.modelValue.$invalid && jobDetailForm.modelValue.$dirty, 
								'has-warning': jobDetailForm.modelValue.$invalid && !jobDetailForm.modelValue.$dirty}">
						<label class="col-md-3 control-label control-label-sm">模值:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" name="modelValue" ng-model="jobDetailVO.modelValue" ng-pattern="/^\d+$/"/>
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobDetailForm.modelValue.$invalid && jobDetailForm.modelValue.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobDetailVO.jobDetailAddType == 'batch' || jobDetailVO.jobDetailAddType == 'sliceBatch'"
						ng-class="{'has-error' : jobDetailForm.modelBeginValue.$invalid && jobDetailForm.modelBeginValue.$dirty, 
								'has-warning': jobDetailForm.modelBeginValue.$invalid && !jobDetailForm.modelBeginValue.$dirty}">
						<label class="col-md-3 control-label control-label-sm"
							ng-class="{true: 'necessary-option'}[jobDetailVO.jobDetailAddType == 'sliceBatch']">模起始值:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" name="modelBeginValue"
								ng-model="jobDetailVO.modelBeginValue" ng-pattern="/^\d+$/" placeholder="根据批量个数依次递增+1" />
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobDetailForm.modelBeginValue.$invalid && jobDetailForm.modelBeginValue.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobDetailVO.jobDetailAddType == 'sliceBatch'"
						ng-class="{'has-error' : jobDetailForm.modelNum.$invalid && jobDetailForm.modelNum.$dirty, 
								'has-warning': jobDetailForm.modelNum.$invalid && !jobDetailForm.modelNum.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">模数量:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" name="modelNum"
								ng-model="jobDetailVO.modelNum" ng-pattern="/^[1-9]\d*$/" placeholder="默认为0" />
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobDetailForm.modelNum.$invalid && jobDetailForm.modelNum.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobDetailVO.jobDetailAddType == 'batch' || jobDetailVO.jobDetailAddType == 'sliceBatch'"
						ng-class="{'has-error' : jobDetailForm.batchBeginValue.$invalid && jobDetailForm.batchBeginValue.$dirty, 
								'has-warning': jobDetailForm.batchBeginValue.$invalid && !jobDetailForm.batchBeginValue.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">子任务批量名称起始序号:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" name="batchBeginValue"
								ng-model="jobDetailVO.batchBeginValue" ng-pattern="/^\d+$/"
								placeholder="默认为0，根据批量个数依次递增+1" />
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobDetailForm.batchBeginValue.$invalid && jobDetailForm.batchBeginValue.$dirty"></span>
						</div>
					</div>
					<div class="form-group has-feedback" ng-show="jobDetailVO.jobDetailAddType == 'batch'" 
						ng-class="{'has-error' : jobDetailForm.batchNum.$invalid && jobDetailForm.batchNum.$dirty, 
								'has-warning': jobDetailForm.batchNum.$invalid && !jobDetailForm.batchNum.$dirty}">
						<label class="col-md-3 control-label control-label-sm necessary-option">批量个数:</label>
						<div class="col-md-8">
							<input type="text" class="form-control input-sm" name="batchNum"
								ng-model="jobDetailVO.batchNum" ng-pattern="/^[1-9]\d*$/" />
							<span class="glyphicon glyphicon-remove form-control-feedback" aria-hidden="true"
									ng-show="jobDetailForm.batchNum.$invalid && jobDetailForm.batchNum.$dirty"></span>
						</div>
					</div>
					<div class="form-group" ng-repeat="param in jobDetailVO.params">
						<label class="col-md-3 control-label control-label-sm">key:</label>
						<div class="col-md-3">
							<input type="text" class="form-control input-sm" ng-model="param.mkey" />
						</div>
						<label class="col-md-1 control-label control-label-sm">value:</label>
						<div class="col-md-3">
							<input type="text" class="form-control input-sm" ng-model="param.mvalue" />
						</div>
						<div class="col-md-2">
							<button type="button" class="btn btn-sm btn-danger" ng-click="removeParamInput(param)">删除</button>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<div class="modal-footer-button">
						<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">取消</button>
						<button type="submit" class="btn btn-sm btn-blue">确认</button>
						<button type="button" class="btn btn-sm btn-blue" ng-click="addParamInput()">添加参数</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
